package com.macro.mall.tiny.component.sms;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 短信接收者
 */
@Component
//@RabbitListener(queues = "mall.sms")
public class SmsReceiver {

    private static final Logger log = LoggerFactory.getLogger(SmsReceiver.class);

    @Autowired
    private SmsClient smsClient;

//    @RabbitHandler
    public void getMsg(String msg){
        log.info("queue mall.sms receive msg:{}",msg);
        String[] split = msg.split(":");
        String mobile = split[0];
        String code = split[1];
        smsClient.send(mobile,code);
    }



    public static void main(String[] args) {
        String[] split = "123:1231".split(":");
        for (String s : split) {
            System.out.println(s);
        }

    }

}
